package com.nlx.notes.module.service.loan;

import com.nlx.notes.module.bean.bo.LoanOverviewBO;
import com.nlx.notes.module.bean.bo.LoanSummaryBO;
import com.nlx.notes.module.bean.dto.loan.LoanSummaryQueryDTO;
import com.nlx.notes.module.bean.dto.loan.LoanSummarySaveDTO;
import com.nlx.notes.module.bean.dto.loan.RepayDetailSaveDTO;
import com.nlx.notes.module.entity.LoanSummary;
import com.baomidou.mybatisplus.extension.service.IService;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author nlx
 * @since 2025-10-25
 */
public interface ILoanSummaryService extends IService<LoanSummary> {

    long countByCondition(LoanSummaryQueryDTO loanSummaryQueryDTO);

    List<LoanSummaryBO> pageByCondition(LoanSummaryQueryDTO loanSummaryQueryDTO);

    LoanSummary findByBorrowerIdAndStatus(Long borrowerId,List<String> status, Long userId);

    LoanSummary saveLoan(LoanSummarySaveDTO loanSummarySaveDTO);

    boolean incTotalLoan(Integer amount, LocalDate loanDAte, Long id);

    void refreshData(Long summaryId, Integer loanTotal, Integer repayTotal);

    /**
     * 统计借款信息
     * @param loanSummaryQueryDTO 参数
     * @return LoanOverviewBO
     */
    LoanOverviewBO sumLoan(LoanSummaryQueryDTO loanSummaryQueryDTO);

    LoanSummary findAndCheckById(Long id,Long userId);

    /**
     * 换狂，修改统计信息
     * @param repayDetailSaveDTO 还款参数
     * @return boolean
     */
    boolean saveRepay(RepayDetailSaveDTO repayDetailSaveDTO);
}
